build: Use pkg-config to find iso-codes
authorTing-Wei Lan <lantw@src.gnome.org>
Sat, 6 Jan 2018 19:39:22 +0000 (03:39 +0800)
committerTing-Wei Lan <lantw@src.gnome.org>
Sun, 7 Jan 2018 06:53:41 +0000 (14:53 +0800)
Instead of hard-coding the path of iso-codes, we can get the prefix with
pkg-config. We still fallback to /usr when it is not available.

https://bugzilla.gnome.org/show_bug.cgi?id=792282

config.h.meson
demos/gtk-demo/language-names.c
gtk/language-names.c
meson.build

index 73836bb9ee476865ab570e927c84b9b7264da98a..54dec7fa82dca6112bb857a86e5b9afc7d9f2ce7 100644 (file)
 #mesondefine HAVE_HARFBUZZ
 
 #mesondefine HAVE_PANGOFT
+
+#mesondefine ISO_CODES_PREFIX
index 2d433cff063ba875337701aca50a28a49c68a5b9..0c0076bbd8f5e4b0d06328a00f9306bdcf2eb457 100644 (file)
@@ -17,7 +17,6 @@
 
 #include "language-names.h"
 
-#define ISO_CODES_PREFIX "/usr"
 #define ISO_CODES_DATADIR ISO_CODES_PREFIX "/share/xml/iso-codes"
 #define ISO_CODES_LOCALESDIR ISO_CODES_PREFIX "/share/locale"
 
index 2d433cff063ba875337701aca50a28a49c68a5b9..0c0076bbd8f5e4b0d06328a00f9306bdcf2eb457 100644 (file)
@@ -17,7 +17,6 @@
 
 #include "language-names.h"
 
-#define ISO_CODES_PREFIX "/usr"
 #define ISO_CODES_DATADIR ISO_CODES_PREFIX "/share/xml/iso-codes"
 #define ISO_CODES_LOCALESDIR ISO_CODES_PREFIX "/share/locale"
 
index 64c73e4a0148d41a71546ba04acc972942e1f056..2b189db8160697d7f67892b486f54fa17f81f77a 100644 (file)
@@ -336,6 +336,7 @@ harfbuzz_dep   = dependency('harfbuzz', version: '>= 0.9', required: false)
 xkbdep         = dependency('xkbcommon', version: xkbcommon_req, required: wayland_enabled)
 graphene_dep   = dependency('graphene-gobject-1.0', version: graphene_req,
                             fallback: ['graphene', 'graphene_dep'])
+iso_codes_dep  = dependency('iso-codes', required: false)
 
 fontconfig_dep = [] # only used in x11 backend
 atkbridge_dep  = [] # only used in x11 backend
@@ -349,6 +350,12 @@ endif
 cdata.set('HAVE_HARFBUZZ', harfbuzz_dep.found())
 cdata.set('HAVE_PANGOFT', pangoft_dep.found())
 
+if iso_codes_dep.found()
+  cdata.set_quoted('ISO_CODES_PREFIX', iso_codes_dep.get_pkgconfig_variable('prefix'))
+else
+  cdata.set_quoted('ISO_CODES_PREFIX', '/usr')
+endif
+
 backend_immodules = []
 
 pc_gdk_extra_libs = []